import java.util.Random;
public class First1 {
    public static void main(String[] args) {
        int[] arr=new int[10];
        Random z=new Random();
        int i=0;
        for(i=0;i<10;i++)
        {
            int a=z.nextInt(100);
            arr[i]=a;
            System.out.print(arr[i]+" ");
        }
        int max=arr[0];
        int min=arr[0];
        int b=0,c=0;
        for(i=0;i<10;i++)
        {
            if(max<arr[i])
            {
                max = arr[i];
                b=i;
            }
            if(min>arr[i])
            {
                min=arr[i];
                c=i;
            }
        }
        System.out.println();
        System.out.println("最大值为"+max+"下标为"+b);
        System.out.println("最小值为"+min+"下标为"+c);
        int j,temp;
        for(i=1;i<10;i++)
        {
            for(j=0;j<=9-i;j++)
            {
                if(arr[j]>arr[j+1])
                {
                    temp = arr[j + 1];
                    arr[j + 1] = arr[j];
                    arr[j] = temp;
                }
            }
        }
        System.out.print("从小到大排序");
        for(i=0;i<10;i++)
            System.out.print(arr[i]+" ");
    }
}
